import type { TableColumnCtx } from 'element-plus';

export interface SpanMethodProps {
  row: any;
  column: TableColumnCtx<any>;
  rowIndex: number;
  columnIndex: number;
}

export const Columns = [
  {
    type: 'selection',
    width: '55',
    'header-align': 'left'
  },
  {
    prop: 'created_at',
    label: '日期',
    width: '100',
    slotName: 'date'
  },
  {
    prop: 'orderno',
    label: '订单号',
    width: '100',
    slotName: 'orderno'
  },
  {
    prop: 'username',
    label: '客户账号',
    slotName: 'username'
  },

  {
    prop: 'code',
    label: '货号',
    width: '100',
    slotName: 'code'
  },
  {
    prop: 'dash',
    label: '批次',
    width: '100',
    slotName: 'code'
  },
  {
    prop: 'price',
    label: '销售单价',
    width: '100',
    slotName: 'price'
  },
  {
    prop: 'nums',
    label: '数量',
    width: '100'
  },
  {
    prop: 'carton',
    label: '箱数',
    width: '100'
  },
  {
    prop: 'amount',
    label: '金额',
    width: '120',
    slotName: 'amount'
  },
  {
    prop: 'shipwayName',
    label: '发货方式',
    width: '200'
  },
  {
    prop: 'statusName',
    label: '状态',
    width: '80'
  },
  {
    label: '操作',
    width: '200',
    slotName: 'operate',
    fixed: 'right'
  }
];

export const formItems = [
  {
    // slotName:
    prop: 'webType',
    label: '--',
    type: 'select',
    options: []
  },
  {
    prop: 'categoryId',
    label: '--',
    type: 'select',
    options: []
  },
  {
    prop: 'itemType',
    label: '--',
    type: 'select',
    options: []
  },
  {
    prop: 'shipway',
    label: '--',
    type: 'select',
    options: []
  },
  {
    prop: 'status',
    label: '--',
    type: 'select',
    multiple: true,
    options: []
  },
  {
    prop: 'countryId',
    label: '--',
    type: 'select',
    multiple: true,
    options: []
  },
  {
    prop: 'orderno',
    label: '订单号',
    options: []
  },
  {
    prop: 'code',
    label: '货号',
    options: []
  },
  {
    prop: 'dash',
    label: '批次号',
    options: []
  },
  {
    prop: 'username',
    label: '用户名',
    options: []
  }
];

/*
true,id,,number,false,,订单主键ID
true,mid,,number,false,,会员ID
true,orderno,,string,false,,订单号
true,subamount,,string,false,,总金额
true,total_nums,,string,false,,总数
true,addressId,,number,false,,收货地址ID
true,status,,number,false,,订单状态
true,ship_at,,string,false,,发货日期
true,payway,,number,false,,付款方式
true,shipway,,number,false,,运输方式
true,shipping,,string,false,,运费
true,chargeWeight,,number,false,,计费重量
true,items,,array,false,,"商品数组，包含 itemid, nums, price"
*/

export const submitFormItems = [
  {
    // slotName:
    prop: 'webType',
    label: '平台账号',
    slotName: 'webType',
    options: []
  },
  {
    prop: 'mid',
    label: '会员账号',
    slotName: 'mid',
    options: []
  },
  {
    prop: 'addressId',
    label: '收获地址',
    slotName: 'address',
    options: []
  },
  {
    prop: 'shipway',
    label: '运输方式',
    slotName: 'shipway',
    options: []
  },
  {
    prop: 'ship_at',
    label: '发货日期',
    slotName: 'date'
  },
  {
    prop: 'payway',
    label: '付款方式',
    type: 'select',
    options: []
  },
  {
    prop: 'shipping',
    label: '运费'
  }
];

interface OrderItem {
  nums: number | string;
  amount: number | string;
  carton: number | string;
  [key: string]: any;
}

export interface SummaryMethodProps<T = OrderItem> {
  columns: TableColumnCtx<T>[];
  data: T[];
}
